import React, { useContext } from 'react';
import { Button } from 'antd';
import { context } from '../../../components/StateBus';
import Two from './Two';

export default function Sub() {
  const { state, dispatch } = useContext(context);
  const onIncrement = () => {
    dispatch({ type: 'increment', payload: {}, loadingName: 'table_loading' });
    // dispatch('show', {type: 'increment'});
  };
  console.log("count:" , state)
  return (
    <div>
      <div>
        sub: {state.count}
        <br/>
        code:{state.result.code}
        <br/>
        loading: {state.table_loading == true ? '加载中' : '加载完成'}
        <br/>
        <Button onClick={onIncrement}>increment</Button>
        <Button>increment</Button>
        <Two/>
      </div>
    </div>
  );
}
